<?php

namespace EasyVote\EasyVoteBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\Role\RoleInterface;

use Knp\DoctrineBehaviors\Model as ORMBehaviors;

/**
 * Stores a user's role in the system.
 *
 * @ORM\Entity(repositoryClass="EasyVote\EasyVoteBundle\Repository\RoleRepository")
 */
class Role implements RoleInterface, ORMBehaviors\Tree\NodeInterface
{
    use ORMBehaviors\Tree\Node;
    /**
     * @var integer
     *
     * @ORM\Column(value="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * The machine value (ROLE_USER)
     * @var string
     * @ORM\Column(value="value", type="string")
     */
    private $value;

    /**
     * The friendlier value (User)
     * @var string
     * @ORM\Column(value="name", type="string")
     */
    private $name;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set id
     *
     * @param integer
     */
    public function setId($id)
    {
        $this->id = $id;
    }

    /**
     * @inheritDoc
     */
    public function getRole()
    {
        return $this->value;
    }

    /**
     * Gets the value of the role.
     * @return string
     */
    public function getValue()
    {
        return $this->value;
    }

    /**
     * Sets the value of the role.
     * @param string $value the new value
     */
    public function setValue($value)
    {
        $this->value = $value;
    }

    /**
     * Gets the value of the role.
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Sets the value of the role.
     * @param string $name the new value
     */
    public function setName($name)
    {
        $this->name = $name;
    }
}

?>
